const dgram = require('dgram');

const target = {
  mes: 'test',
  address: '127.0.0.1',
  port: 1234
}

const runAt = {
  port: 1235,
  address: '127.0.0.1'
}

const socket = new dgram.createSocket('udp4');

socket.on('message', (mes) => {
  process.stdout.write(`${mes}`);
  socket.close();
})

socket.bind(runAt.port, runAt.address);

// socket.bind(runAt.port, runAt.address);
socket.send(target.mes, target.port, target.address, (err) => {
  console.log(err);
});
